<template>
    <div>
        <el-container style="height: 721px; border: 1px solid #eee">
            <el-aside width="200px" style="background-color: #545c64">
                <el-row class="tac">
                    <el-col>
                        <el-menu
                        default-active="2"
                        class="el-menu-vertical-demo"
                        background-color="#545c64"
                        text-color="#fff"
                        active-text-color="#ffd04b">
                        <el-submenu index="1">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>商品</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item @click="onClick('/products')">商品列表</el-menu-item>
                                <el-menu-item @click="onClick('/upproduct')">商品发布</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="2">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>订单</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item @click="onClick('/order')">商品订单</el-menu-item>
                                <el-menu-item @click="onClick('/return_goods')">退货管理</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="3">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>营销</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item @click="onClick('/coupon')">申请优惠券</el-menu-item>
                                <el-menu-item @click="onClick('/seckill')">申请秒杀活动</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        </el-menu>
                    </el-col>
                </el-row>
            </el-aside>
        
            <el-container>
                <el-header style="text-align: right; font-size: 12px">
                    <span style="font-size:15px">{{this.$cookies.get("shopname")}}</span>
                    <el-dropdown style="padding-left:20px">
                        <i class="el-icon-setting" style="margin-right: 15px;font-size:20px"></i>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item><a @click="chengshop">修改店铺信息</a></el-dropdown-item>
                            <el-dropdown-item><a @click="outlogin">退出</a></el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </el-header>
                
                <el-main>
                    <router-view/>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>

<script>
export default {
    name: "shoppage",
    mounted(){
            this.$axios.post("/api/shop",this.$querystring.stringify({
            name:this.$cookies.get("shopname"),
            })).then(reponse=>{
            console.log(reponse);
            })
            .catch(error=>{
            console.log(error);
            })
    },
    methods: {
      outlogin() {
        this.$cookies.remove("shopname");
        this.$router.go(0)
      },
      onClick(url){
          this.$router.push(url)
      },
      chengshop(){
          this.$router.push('/changshop')
      }
    }
}
</script>

<style scoped>
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }
  
  .el-aside {
    color: #333;
  }
</style>